package com.ysyc.driver_ee.impl;

import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;


/**
 * viewpager滑动默认有切换效果，
 *   mViewPager.setCurrentItem(tab.getPosition(),false); 去掉默认切换效果
 */
public class ViewPagerChangeListener extends TabLayout.ViewPagerOnTabSelectedListener{
    private final ViewPager mViewPager;
    private String[] TAB_TITLES;
    public ViewPagerChangeListener(ViewPager viewPager) {
        super(viewPager);
        mViewPager = viewPager;
    }
    public ViewPagerChangeListener(ViewPager mViewPager, String [] TAB_TITLES) {
        super(mViewPager);
        this.mViewPager = mViewPager;
        this.TAB_TITLES = TAB_TITLES;
    }



    @Override
    public void onTabSelected(TabLayout.Tab tab) {
        mViewPager.setCurrentItem(tab.getPosition(),false);
    }


}
